package com.nbsaas.boot.product.rest.resource;

import com.nbsaas.boot.product.api.apis.ProductCategoryApi;
import com.nbsaas.boot.product.data.entity.ProductCategory;
import com.nbsaas.boot.product.api.domain.request.ProductCategoryRequest;
import com.nbsaas.boot.product.api.domain.response.ProductCategoryResponse;
import com.nbsaas.boot.product.api.domain.simple.ProductCategorySimple;
import com.nbsaas.boot.product.rest.convert.ProductCategorySimpleConvert;
import com.nbsaas.boot.product.rest.convert.ProductCategoryEntityConvert;
import com.nbsaas.boot.product.rest.convert.ProductCategoryResponseConvert;
import com.nbsaas.boot.product.data.repository.ProductCategoryRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   商品分类-业务接口实现
*/
@Transactional
@Service
public class ProductCategoryResource extends BaseResource<ProductCategory,ProductCategoryResponse, ProductCategorySimple, ProductCategoryRequest>  implements ProductCategoryApi {

    @Resource
    private ProductCategoryRepository productCategoryRepository;

    @Override
    public JpaRepositoryImplementation<ProductCategory, Serializable> getJpaRepository() {
        return productCategoryRepository;
    }

    @Override
    public Function<ProductCategory, ProductCategorySimple> getConvertSimple() {
        return new ProductCategorySimpleConvert();
    }

    @Override
    public Function<ProductCategoryRequest, ProductCategory> getConvertForm() {
        return new ProductCategoryEntityConvert();
    }

    @Override
    public Function<ProductCategory, ProductCategoryResponse> getConvertResponse() {
        return new ProductCategoryResponseConvert();
    }




}


